package com.shop.loan.model;

import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.Readonly;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.DateType;
import xyz.erupt.annotation.sub_field.sub_edit.Search;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

@Setter
@Getter
@Entity
@Table(name = "s_machine_rule_log",
        uniqueConstraints = {
                @UniqueConstraint(columnNames = "user_id")
        })
@Erupt(
        name = "机审规则记录",
        power = @Power(add = false, delete = false, edit = false, viewDetails = false)
)
public class MachineRuleLog extends BaseModel {


    @Column(name = "order_id")
    private Long orderId;

    @Column(name = "user_id")
    private Long userId;

    @EruptField(
            views = @View(title = "分数"),
            edit = @Edit(title = "分数", notNull = true)
    )
    private BigDecimal score;

    @Lob
    @EruptField(
            views = @View(title = "规则详情"),
            edit = @Edit(title = "规则详情", notNull = true)
    )
    private String ruleDetail;

    @EruptField(
            views = @View(title = "创建时间"),
            edit = @Edit(title = "创建时间",
                    search = @Search(vague = true),
                    readonly = @Readonly,
                    dateType = @DateType(type = DateType.Type.DATE_TIME))
    )
    private Date createTime;

    private Date updateTime;

}
